package top.xchch.tool.mockito.juejin;

import org.junit.Test;

import java.util.List;

import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verifyZeroInteractions;

/**
 * 验证mock对象没有产生过交互
 */
public class InteractionNeverHappenedTest07 {
    @Test
    public void testInteractionNeverHappened() {
        List mockOne = mock(List.class);
        List mockTwo = mock(List.class);

        //测试通过
        verifyZeroInteractions(mockOne, mockTwo);

        mockOne.add("");
        //测试不通过，因为mockOne已经发生过交互了
        verifyZeroInteractions(mockOne, mockTwo);
    }

}
